package utils
{
	import flash.utils.Dictionary;

	public class Table
	{
		private var _keyData:Dictionary=new Dictionary
		private var _dataKey:Dictionary=new Dictionary
		public function Table(obj:Object=null)
		{
			if(obj==null) return ;
		    if(obj is Array){
                 for(var i:int=0;i<obj.length;i++){
					 _keyData[i]=obj[i];
					 _dataKey[obj[i]]=i;
				 }
		   }else{
			   for(var k:* in obj){
			        _keyData[k]=obj[k];
					_dataKey[obj[k]]=k;
			   }
		   }
		}
		public function push(key:*,data:*):void{
			_keyData[key]=data;
			_dataKey[data]=key;
		}
		public function getData(key:*):Object{
		   return _keyData[key]
		}
		public function getKey(data:*):Object{
		  return _dataKey[data];
		}
	}
}